
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>qilu-logTrace · 启路框架-使用手册</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="qilu-export-readme.html" />
    
    
    <link rel="prev" href="qiluMybatis-readme.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    整体介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../ready/ready.html">
            
                <a href="../ready/ready.html">
            
                    
                    技术准备
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../ready/ide.html">
            
                <a href="../ready/ide.html">
            
                    
                    eclipse
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../ready/build.html">
            
                <a href="../ready/build.html">
            
                    
                    本地构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../ready/nexus.html">
            
                <a href="../ready/nexus.html">
            
                    
                    私服构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../ready/run.html">
            
                <a href="../ready/run.html">
            
                    
                    运行调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../ready/specification.html">
            
                <a href="../ready/specification.html">
            
                    
                    结构和分包
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="baseReadme.html">
            
                <a href="baseReadme.html">
            
                    
                    基础包介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="qiluTask-readme.html">
            
                <a href="qiluTask-readme.html">
            
                    
                    qilu-task
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="cache-readme.html">
            
                <a href="cache-readme.html">
            
                    
                    qilucache
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="qiluMybatis-readme.html">
            
                <a href="qiluMybatis-readme.html">
            
                    
                    qilu-mybatis
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.4" data-path="logTrace-readme.html">
            
                <a href="logTrace-readme.html">
            
                    
                    qilu-logTrace
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="qilu-export-readme.html">
            
                <a href="qilu-export-readme.html">
            
                    
                    qilu-export
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="httpService-readme.html">
            
                <a href="httpService-readme.html">
            
                    
                    qilu-http-service
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="validateReadme.html">
            
                <a href="validateReadme.html">
            
                    
                    qilu-validate
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../state/state-course.html">
            
                <a href="../state/state-course.html">
            
                    
                    交易一致的由来
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../state/state-settle.html">
            
                <a href="../state/state-settle.html">
            
                    
                    qilu-state使用说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../state/state-demo.html">
            
                <a href="../state/state-demo.html">
            
                    
                    购买订单的处理示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../backSample/backSampleReadme.html">
            
                <a href="../backSample/backSampleReadme.html">
            
                    
                    后台代码模板
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../backSample/security.html">
            
                <a href="../backSample/security.html">
            
                    
                    安全介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../backSample/deploy.html">
            
                <a href="../backSample/deploy.html">
            
                    
                    部署集成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../backSample/config.html">
            
                <a href="../backSample/config.html">
            
                    
                    spring配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../backSample/sso.html">
            
                <a href="../backSample/sso.html">
            
                    
                    SSO集成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../backSample/example.html">
            
                <a href="../backSample/example.html">
            
                    
                    常见代码示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../test/readme.html">
            
                <a href="../test/readme.html">
            
                    
                    关于测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../test/unitTest.html">
            
                <a href="../test/unitTest.html">
            
                    
                    单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../test/function.html">
            
                <a href="../test/function.html">
            
                    
                    功能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../test/noFunction.html">
            
                <a href="../test/noFunction.html">
            
                    
                    非功能测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../video/test.html">
            
                <a href="../video/test.html">
            
                    
                    视频
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../video/build.html">
            
                <a href="../video/build.html">
            
                    
                    项目构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../video/state.html">
            
                <a href="../video/state.html">
            
                    
                    交易一致
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >qilu-logTrace</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="qilu-logtrace&#x4ECB;&#x7ECD;">qilu-logTrace&#x4ECB;&#x7ECD;</h1>
<p>logTrace&#x662F;&#x5728;&#x6392;&#x9519;&#x7684;&#x65F6;&#x5019;,&#x67E5;&#x8BE2;&#x670D;&#x52A1;&#x5668;&#x65E5;&#x5FD7;&#x7684;&#x65F6;&#x5019;&#x5192;&#x51FA;&#x6765;&#x7684;&#x9700;&#x6C42;.&#x4E00;&#x65E6;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x88AB;&#x90E8;&#x7F72;&#x5230;&#x670D;&#x52A1;&#x5668;&#x4E0A;&#x4EE5;&#x540E;,&#x5728;&#x5E94;&#x7528;&#x7684;&#x624B;&#x6BB5;&#x5185;,&#x5C31;&#x53EA;&#x80FD;&#x770B;&#x5230;&#x65E5;&#x5FD7;&#x60C5;&#x51B5;,&#x800C;&#x65E5;&#x5FD7;&#x672C;&#x8EAB;&#x4F1A;&#x53D7;&#x5230;&#x591A;&#x7EBF;&#x7A0B;&#x5E76;&#x53D1;&#x7684;&#x5F71;&#x54CD;,&#x5728;&#x5E76;&#x53D1;&#x6BD4;&#x8F83;&#x5927;&#x7684;&#x60C5;&#x51B5;&#x4E0B;,&#x6392;&#x67E5;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;&#x6267;&#x884C;&#x60C5;&#x51B5;,&#x5982;&#x679C;&#x6CA1;&#x6709;&#x4E00;&#x4E2A;traceKey&#x4F5C;&#x4E3A;&#x67E5;&#x8BE2;&#x6761;&#x4EF6;&#x7684;&#x8BDD;,&#x4F1A;&#x9762;&#x4E34;&#x4E00;&#x79CD;&#x5F88;&#x65E0;&#x529B;&#x7684;&#x5C40;&#x9762;.</p>
<p>logTrace&#x6700;&#x5927;&#x7684;&#x60F3;&#x6CD5;,&#x662F;&#x7ED3;&#x5408;linux&#x7684;grep&#x547D;&#x4EE4;,&#x5728;&#x6700;&#x5C0F;&#x4FB5;&#x5165;&#x5F00;&#x53D1;&#x7684;&#x60C5;&#x51B5;&#x4E0B;,&#x6700;&#x5927;&#x7A0B;&#x5EA6;&#x7684;&#x63D0;&#x4F9B;&#x65E5;&#x5FD7;&#x67E5;&#x8BE2;&#x7684;&#x7B80;&#x6D01;---&#x901A;&#x8FC7;2&#x7EC4;grep&#x547D;&#x4EE4;,&#x6765;&#x5B9E;&#x73B0;&#x67E5;&#x770B;&#x67D0;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;&#x6240;&#x6709;&#x65E5;&#x5FD7;.</p>
<h2 id="&#x4EE3;&#x7801;&#x96C6;&#x6210;">&#x4EE3;&#x7801;&#x96C6;&#x6210;</h2>
<h3 id="maven&#x4F9D;&#x8D56;">maven&#x4F9D;&#x8D56;</h3>
<pre class="language-"><code class="lang-xml">logback&#x96C6;&#x6210;&#x8BF7;&#x5F15;&#x5165;
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>com.9istock.base<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>qilu-logtrace-logback<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">&gt;</span></span>1.0.0<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
log4j&#x96C6;&#x6210;,&#x8BF7;&#x5F15;&#x5165;
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>com.9istock.base<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>qilu-logtrace-log4j<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">&gt;</span></span>1.0.0<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>&#x65E5;&#x5FD7;&#x914D;&#x7F6E;</p>
<pre class="language-"><code class="lang-xml">logback&#x7684;&#x65E5;&#x5FD7;&#x914D;&#x7F6E;,&#x9700;&#x8981;&#x52A0;&#x4E0A;encoder&#x7684;&#x914D;&#x7F6E;,&#x7279;&#x6B8A;&#x5B9A;&#x4E49;pattern
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>property</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>default_pattern<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>%d [%t - %X{traceNo}] %-5level %c{1} - %m%n<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>appender</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>STDOUT<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>ch.qos.logback.core.ConsoleAppender<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>encoder</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>com.istock.base.logtrace.logback.encoder.TraceNoPatternLayoutEncoder<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>charset</span><span class="token punctuation">&gt;</span></span>UTF-8<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>charset</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>pattern</span><span class="token punctuation">&gt;</span></span>${default_pattern}<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>pattern</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>encoder</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>appender</span><span class="token punctuation">&gt;</span></span>

log4j&#x7684;&#x65E5;&#x5FD7;&#x914D;&#x7F6E;,&#x76F4;&#x63A5;&#x914D;&#x7F6E;pattern
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>appender</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>CONSOLE-APPENDER<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>org.apache.log4j.ConsoleAppender<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>param</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>encoding<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>UTF-8<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>layout</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>com.istock.base.logtrace.log4j.encoder.TraceNoPatternLayout<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>param</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>ConversionPattern<span class="token punctuation">&quot;</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>%d %p [%t - %X{traceNo}] %c{2} - %m%n<span class="token punctuation">&quot;</span></span> <span class="token punctuation">/&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>layout</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>appender</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<h3 id="&#x4F7F;&#x7528;">&#x4F7F;&#x7528;</h3>
<h4 id="webxml&#x914D;&#x7F6E;">web.xml&#x914D;&#x7F6E;</h4>
<p>&#x5982;&#x679C;&#x5E0C;&#x671B;&#x5728;&#x6240;&#x6709;&#x7684;&#x670D;&#x52A1;&#x7AEF;controller&#x4E2D;&#x52A0;&#x5165;trace&#x65E5;&#x5FD7;,&#x5728;&#x6240;&#x6709;&#x670D;&#x52A1;&#x7AEF;&#x8BF7;&#x6C42;&#x4E2D;&#x589E;&#x52A0;&#x8FC7;&#x6EE4;&#x5668;,&#x5728;&#x65E5;&#x5FD7;&#x4E2D;&#x95F4;&#x4EF6;&#x4E2D;&#x52A0;&#x5165;trace</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>filter</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>filter-name</span><span class="token punctuation">&gt;</span></span>traceNoFilter<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>filter-name</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>filter-class</span><span class="token punctuation">&gt;</span></span>com.istock.base.logtrace.filter.TraceNoFilter<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>filter-class</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>filter</span><span class="token punctuation">&gt;</span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>filter-mapping</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>filter-name</span><span class="token punctuation">&gt;</span></span>traceNoFilter<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>filter-name</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>url-pattern</span><span class="token punctuation">&gt;</span></span>*.do<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>url-pattern</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>filter-mapping</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>&#x4F7F;&#x7528;&#x4E0A;&#x8FF0;&#x914D;&#x7F6E;,&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4F1A;&#x5728;controller&#x7684;&#x5165;&#x53E3;,&#x52A0;&#x5165;&#x65E5;&#x5FD7;&#x7684;trace&#x4FE1;&#x606F;</p>
<p>&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6B63;&#x5E38;&#x4F7F;&#x7528;log&#x7EC4;&#x4EF6;&#x8F93;&#x51FA;</p>
<p>&#x5728;&#x6574;&#x4E2A;&#x7EBF;&#x7A0B;&#x5806;&#x6808;&#x91CC;&#x9762;&#x90FD;&#x4F1A;&#x6253;&#x5370;&#x51FA;&#x76F8;&#x540C;&#x7684;trace</p>
<ol>
<li>2019-08-27 13:52:23,532 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] INFO  c.i.b.a.s.AutoTaskService - to lock task taskType[CLEAR_ONLINE],taskNo[20190827135323],taskState[WAITING_EXECUTE],curExecTime[null],curExecutor[null]</li>
<li>2019-08-27 13:52:23,690 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.b.a.d.AutoTaskDAO - =======update by selective:UPDATE SYS_AUTO_TASK SET TASK_NO=:taskNo,TASK_TYPE=:taskType,CUR_EXECUTOR=:curExecutor,LAST_EXEC_TIME=:lastExecTime,LAST_EXECUTOR=:lastExecutor,EXECUTED_TIMES=:executedTimes,TASK_STATE=:taskState,UPDATE_TIME=:updateTime WHERE TASK_NO=:taskNo AND TASK_TYPE=:taskType AND TASK_STATE &lt;&gt; :notTaskState AND CUR_EXECUTOR IS NULL =====</li>
<li>2019-08-27 13:52:23,690 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.b.a.d.AutoTaskDAO - ==========updateByExample paramMap :{lastExecutor=3164@MicroWin10-1452|130.252.10.0|atomic-task-asyn-1|30, serialVersionUID=1, taskType=CLEAR_ONLINE, taskState=EXECUTING, executedTimes=1, taskNo=20190827135323, curExecutor=3164@MicroWin10-1452|130.252.10.0|atomic-task-asyn-1|30, updateTime=Tue Aug 27 13:52:23 CST 2019, lastExecTime=Tue Aug 27 13:52:23 CST 2019, notTaskState=COMPLETE, moreLastExecedTime=null}</li>
<li>2019-08-27 13:52:23,691 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] INFO  c.i.b.a.s.AutoTaskService - locked task taskType[CLEAR_ONLINE],taskNo[20190827135323] by 3164@MicroWin10-1452|130.252.10.0|atomic-task-asyn-1|30</li>
<li>2019-08-27 13:52:23,725 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] INFO  c.i.u.u.t.UserOnlineTask - ready to execute user online expire clear task===============</li>
<li>2019-08-27 13:52:23,816 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.u.u.d.U.deleteByExample - ==&gt;  Preparing: delete from SYS_USER_ONLINE_INFO WHERE ( EXPIRE_TIME &lt;= ? ) </li>
<li>2019-08-27 13:52:23,826 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.u.u.d.U.deleteByExample - ==&gt; Parameters: 2019-08-27 13:52:23.728(Timestamp)</li>
<li>2019-08-27 13:52:23,828 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.u.u.d.U.deleteByExample - &lt;==    Updates: 0</li>
<li>2019-08-27 13:52:23,829 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] INFO  c.i.u.u.t.UserOnlineTask - end for execute user online expire clear task , delete 0 record===============</li>
<li>2019-08-27 13:52:23,830 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.b.a.d.AutoTaskDAO - =============the update sql:UPDATE SYS_AUTO_TASK SET TASK_NO=:taskNo,TASK_TYPE=:taskType,NEXT_EXEC_TIME=:nextExecTime,LAST_EXECED_TIME=:lastExecedTime,EXEC_MSG=:execMsg,TASK_STATE=:taskState,UPDATE_TIME=:updateTime WHERE TASK_NO=:taskNo AND TASK_TYPE=:taskType</li>
<li>2019-08-27 13:52:23,830 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] DEBUG c.i.b.a.d.AutoTaskDAO - ==========updateBykey paramMap :{nextExecTime=Tue Aug 27 13:52:28 CST 2019, serialVersionUID=1, taskType=CLEAR_ONLINE, taskState=COMPLETE, lastExecedTime=Tue Aug 27 13:52:23 CST 2019, taskNo=20190827135323, execMsg=, updateTime=Tue Aug 27 13:52:23 CST 2019}</li>
<li>2019-08-27 13:52:23,833 [atomic-task-asyn-1 - <strong style="color:red">uLVPoWmpHm4Q</strong>] INFO  c.i.b.a.s.AutoTaskService - executed task taskType[CLEA</li>
</ol>
<blockquote>
<ul>
<li>&#x5148;&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x884C;grep &#x8BA2;&#x5355;ID xxx.log&#x5728;log&#x65E5;&#x5FD7;&#x4E2D;&#x67E5;&#x8BE2;&#x67D0;&#x4E2A;&#x8BA2;&#x5355;&#x7684;&#x5904;&#x7406;&#x65E5;&#x5FD7;,&#x627E;&#x5230;&#x5176;&#x4E2D;&#x4E00;&#x4E2A;&#x7684;traceNo</li>
<li>&#x5728;&#x4F7F;&#x7528; <code>grep &apos;uLVPoWmpHm4Q&apos; xxx.log -col</code> &#x5C31;&#x80FD;&#x591F;&#x770B;&#x5230;&#x67D0;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;&#x6240;&#x6709;&#x64CD;&#x4F5C;</li>
</ul>
</blockquote>
<h4 id="&#x591A;&#x7EBF;&#x7A0B;&#x8C03;&#x7528;">&#x591A;&#x7EBF;&#x7A0B;&#x8C03;&#x7528;</h4>
<p>&#x5982;&#x679C;&#x51FA;&#x73B0;&#x7EBF;&#x7A0B;&#x6C60;,&#x6216;&#x8005;MQ&#x7684;&#x8BF7;&#x6C42;,&#x6211;&#x4EEC;&#x9700;&#x8981;&#x624B;&#x52A8;&#x8BBE;&#x7F6E;&#x7C7B;&#x4F3C;&#x7684;trace&#x64CD;&#x4F5C;</p>
<pre class="language-"><code class="lang-java"><span class="token class-name">TraceNoUtils</span><span class="token punctuation">.</span><span class="token function">newTraceNo</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token class-name">LoggerFactory</span><span class="token punctuation">.</span><span class="token function">getLogger</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;test&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token class-name">Thread</span> t <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Thread</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">InheritTraceNoRunableWrapper</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Runnable</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>

    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">run</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token class-name">LoggerFactory</span><span class="token punctuation">.</span><span class="token function">getLogger</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;thread&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token class-name">LoggerFactory</span><span class="token punctuation">.</span><span class="token function">getLogger</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;thread&quot;</span><span class="token punctuation">,</span> <span class="token keyword">new</span> <span class="token class-name">Exception</span><span class="token punctuation">(</span><span class="token string">&quot;exception&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
t<span class="token punctuation">.</span><span class="token function">start</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
t<span class="token punctuation">.</span><span class="token function">join</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token class-name">LoggerFactory</span><span class="token punctuation">.</span><span class="token function">getLogger</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;abb\nnewLine&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token class-name">TraceNoUtils</span><span class="token punctuation">.</span><span class="token function">clearTraceNo</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x6700;&#x7EC8;&#x8F93;&#x51FA;</p>
<ol>
<li>2019-08-27 14:15:15,340 [main - <strong style="color:red">lw8IjvWkXYDb</strong>] INFO  c.i.b.l.t.TraceNoUtilsTest - test</li>
<li>2019-08-27 14:15:15,343 [Thread-0 - <strong style="color:red">lw8IjvWkXYDb-iPkVbt</strong>] INFO  c.i.b.l.t.TraceNoUtilsTest$1 - thread</li>
<li>2019-08-27 14:15:15,347 [Thread-0 - <strong style="color:red">lw8IjvWkXYDb-iPkVbt</strong>] INFO  c.i.b.l.t.TraceNoUtilsTest$1 - thread</li>
<li>[<strong style="color:red">lw8IjvWkXYDb-iPkVbt</strong>]    java.lang.Exception: exception</li>
<li>[<strong style="color:red">lw8IjvWkXYDb-iPkVbt</strong>]        at com.istock.base.logtrace.test.TraceNoUtilsTest$1.run(TraceNoUtilsTest.java:20) [test-classes/:na]</li>
<li>[<strong style="color:red">lw8IjvWkXYDb-iPkVbt</strong>]        at com.istock.base.logtrace.wrapper.InheritTraceNoRunableWrapper.run(InheritTraceNoRunableWrapper.java:27) [classes/:na]</li>
<li>[<strong style="color:red">lw8IjvWkXYDb-iPkVbt</strong>]        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
8.2019-08-27 14:15:15,347 [main - <strong style="color:red">lw8IjvWkXYDb</strong>] INFO  c.i.b.l.t.TraceNoUtilsTest - abb</li>
</ol>
<p>&#x672C;&#x65B9;&#x6CD5;&#x9002;&#x7528;&#x4E8E;&#x7EBF;&#x7A0B;&#x6C60;&#x6216;&#x8005;MQ&#x7684;&#x8C03;&#x7528;</p>
<ol>
<li>&#x5728;&#x65B9;&#x6CD5;&#x542F;&#x52A8;&#x524D;,&#x4F7F;&#x7528;TraceNoUtils.newTraceNo()</li>
<li>&#x5728;&#x521B;&#x5EFA;Thread&#x7684;&#x65F6;&#x5019;&#x4F7F;&#x7528;InheritTraceNoRunableWrapper&#x5305;&#x88C5;</li>
<li>&#x5728;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x540E;,&#x9700;&#x8981;TraceNoUtils.clearTraceNo()</li>
</ol>
<p>&#x7279;&#x522B;&#x662F;&#x5728;&#x6CA1;&#x6709;&#x4F7F;&#x7528;ThreadFactory&#x6784;&#x5EFA;&#x7EBF;&#x7A0B;&#x540D;&#x79F0;&#x7684;&#x65F6;&#x5019;,&#x539F;&#x672C;&#x7684;&#x56F0;&#x96BE;&#x7684;&#x6392;&#x9519;,&#x66F4;&#x52A0;&#x80FD;&#x663E;&#x793A;logTrace&#x7684;&#x4F18;&#x52BF;.</p>
<p>&#x5728;&#x6CA1;&#x6709;&#x4F7F;&#x7528;ETL&#x7684;&#x60C5;&#x51B5;&#x4E0B;,logTrace&#x662F;&#x6700;&#x7B80;&#x5355;,&#x4FB5;&#x5165;&#x6700;&#x5C0F;,&#x4F7F;&#x7528;&#x6700;&#x65B9;&#x4FBF;&#x7684;&#x65E5;&#x5FD7;&#x6392;&#x67E5;&#x65B9;&#x5F0F;,&#x5230;&#x76EE;&#x524D;&#x4E3A;&#x6B62;,&#x6CA1;&#x6709;&#x4E4B;&#x4E00;.</p>
<p>&#x5C31;&#x7B97;&#x662F;&#x7528;&#x4E86;ETL,logTrace&#x672C;&#x8EAB;&#x4E5F;&#x548C;ETL&#x4E0D;&#x51B2;&#x7A81;.&#x4E3B;&#x8981;&#x662F;&#x56E0;&#x4E3A;&#x4FB5;&#x5165;&#x5C0F;,&#x6210;&#x672C;&#x4F4E;. </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; senvon 2020 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">Bilibili,&#x5934;&#x6761;&#x53F7;,&#x5FAE;&#x4FE1;&#x53F7;&#xFF1A;&#x8BF7;&#x641C;&#x7D22;  &#x968F;senvon&#x98DE;
2021-09-01 14:42:41
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="qiluMybatis-readme.html" class="navigation navigation-prev " aria-label="Previous page: qilu-mybatis">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="qilu-export-readme.html" class="navigation navigation-next " aria-label="Next page: qilu-export">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"qilu-logTrace","level":"1.3.4","depth":2,"next":{"title":"qilu-export","level":"1.3.5","depth":2,"path":"base/qilu-export-readme.md","ref":"base/qilu-export-readme.md","articles":[]},"previous":{"title":"qilu-mybatis","level":"1.3.3","depth":2,"path":"base/qiluMybatis-readme.md","ref":"base/qiluMybatis-readme.md","articles":[]},"dir":"ltr"},"config":{"plugins":["search-plus","-lunr","-search","tbfed-pagefooter","simple-page-toc","insert-logo","back-to-top-button","toggle-chapters","code","lightbox","copy-code-button","search-pro","emphasize","splitter","mermaid-gb3","-sharing","sharing-plus","prism","-highlight","flexible-alerts","page-toc-button","baidu","pageview-count","bilibili","donate","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy senvon 2020","modify_label":"Bilibili,头条号,微信号：请搜索  随senvon飞"},"prism":{},"emphasize":{},"livereload":{},"simple-page-toc":{"maxDepth":5,"skipFirstH1":true},"splitter":{},"search-pro":{},"bilibili":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"code":{"copyButtons":true},"donate":{"alipay":"images/toutiao.jpg","alipayText":"头条号","button":"联系方式","title":"联系方式","wechat":"images/weixin.PNG","wechatText":"公众号"},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"lightbox":{"jquery":true,"sameUuid":false},"page-toc-button":{"maxTocDepth":5,"minTocSize":2},"back-to-top-button":{},"pageview-count":{},"flexible-alerts":{"danger":{"className":"danger","icon":"fa fa-ban","label":"Attention"},"note":{"className":"info","icon":"fa fa-info-circle","label":"Note"},"style":"flat","tip":{"className":"tip","icon":"fa fa-lightbulb-o","label":"Tip"},"warning":{"className":"warning","icon":"fa fa-exclamation-triangle","label":"Warning"}},"copy-code-button":{},"baidu":{"token":"51550945f89f43511a44753249ab6675"},"sharing":{"qq":true,"all":["douban","qq","qzone","weibo"],"douban":false,"facebook":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{},"insert-logo":{"style":"background: none; height: 170px; width: 200px","url":"images/logo3.jpg"},"search-plus":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"启路框架-使用手册","language":"zh-hans","backplugin":["lightbox"],"gitbook":"*","description":"启路框架-使用手册"},"file":{"path":"base/logTrace-readme.md","mtime":"2021-09-01T06:42:41.304Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-10-19T02:57:27.717Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-baidu/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

